LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-03-2005, 09:27 AM   #1
rose_bud4201
Member
 
Registered: Aug 2002
Location: St Louis, MO
Distribution: Xubuntu, RHEL, Solaris 10
Posts: 929

Rep: Reputation: 30
PHP "Expecting `T_STRING'...", and it's driving me nuts


Can someone please help me find out what's wrong with this code? It's in the middle of a web page, so I'll pull out everything around it.

Code:
  echo <<< END
    <BR>
    <BR><CENTER><DIV STYLE="font-family: tahoma; font-size: 10px">
       <<<-- <a href="http://www.website.com/index_test.php?skip=$goBack">Go Earlier?</a> | <a href="http://www.website.com/index_test.php?skip=$goForward">Go Later?</a> -->>><BR><BR><a href="mailto:admin@website.com">Contact?</a>
    </DIV></CENTER><BR>
END;
} // Ends if-else

mysql_close($connection);
?>
	<!--	</div></DIV> -->
	   </TD>
	   </TR>
   	</TABLE>
    </TD>
    <TD VALIGN="TOP" WIDTH="20%">
	<TABLE>
	    <TR>
	       <TD>
			<!-- Top right-hand box -->
                         <DIV align="center"><div style="text-align:left; padding:5px; background-color:#ae4a48; border:1px solid black; font-size:12px; color:#000000; width:150px; font-family:verdana; font-size:10">
<?
	  if($_SESSION['CurrentUserID'] == 'true') { 
	  print ("<CENTER>You are logged in as<BR><a href=\"" . $_SESSION['CurrentUserID'] . "\">" . $_SESSION['ShortUserID'] . "</a> (<a href=\"http://www.cybermenology.com/logout.php\">log out?</a>)</CENTER>");
	} else {
	  print ("<CENTER>You are not <a href=\"http://www.cybermenology.com/login.php\">logged in</a></CENTER>");
	}
?>
                  </DIV><BR>
                  <DIV align="center"><div style="text-align:left; padding:5px; background-color:#ae4a48; border:1px solid black; font-size:12px; color:#000000; width:150px; font-family:verdana; font-size:10">
I keep getting the message "Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /var/www/html/index.php on line 306", and I can't for the life of me see what's wrong with that line! I've moved it down a few lines in the file, just to verify that it's the correct line#, and it is... Please, what am I missing?
(I have the call to session_start() up at the top of the file, and there's around 300 other lines of php code which use session variables just fine before hitting this one.)

This is driving my absolutely nuts...
 
Old 11-03-2005, 09:32 AM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

Try modifying your php.ini file, and make sure "register globals" is enabled:

http://us2.php.net/register_globals
 
Old 11-03-2005, 10:19 AM   #3
rose_bud4201
Member
 
Registered: Aug 2002
Location: St Louis, MO
Distribution: Xubuntu, RHEL, Solaris 10
Posts: 929

Original Poster
Rep: Reputation: 30
Unfortunately, it is:

; You should do your best to write your scripts so that they do not require
; register_globals to be on; Using form variables as globals can easily lead
; to possible security problems, if the code is not very well thought of.
register_globals = On

What makes this weird is there's nothing wrong with that line, and I've used that same variable previously in the file...if the syntax parser was going to have a problem with it, why pick a later occurrance of it?
 
Old 11-03-2005, 11:08 AM   #4
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Make sure the quotes match and every line has a semicolon.

One thing that helps debugging is to save a complicated expression to a variable, then "print" (or "echo") the variable.
Code:
EXAMPLE:
  // Original
  print ("something " . $adverb asdflkjadfkljakl "\" ...;

  // Debugging tip: save to variable, check variable
  $s = "something " . $adverb asdflkjadfkljakl "\" ...;
  print ("<<" . $s . ">>\n");
 
Old 11-03-2005, 01:36 PM   #5
rose_bud4201
Member
 
Registered: Aug 2002
Location: St Louis, MO
Distribution: Xubuntu, RHEL, Solaris 10
Posts: 929

Original Poster
Rep: Reputation: 30
Well....I fooled around with it a bit, moved some of the more complex and hard-to-read expressions into variables, deleted some stuff and put it back in...in short, I have no idea what I did, but somehow it works again.

Many thanks!!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Telling people to use "Google," to "RTFM," or "Use the search feature" Ausar General 77 03-21-2010 11:26 AM
"Xlib: extension "XFree86-DRI" missing on display ":0.0"." zaps Linux - Games 9 05-14-2007 03:07 PM
cd mount mandriva 2005 "driving" me insane Skankpuss Linux - Hardware 2 05-28-2005 06:25 PM
"Driving Me Insane" heartagram Linux - Software 2 09-16-2003 07:09 PM
php ide with "break" and "trace" Kayaker Programming 3 04-25-2003 02:52 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration